package main

import (
	"go-project/common"
	"go-project/cron"
	"go-project/router"
)

//go:generate go env -w GO111MODULE=on
//go:generate go env -w GOPROXY=https://goproxy.cn,direct
//go:generate go mod tidy
//go:generate go mod download

func main() {
	common.Init()

	//autoMigrate
	for _, entity := range common.AutoMigrate {
		err := common.DB.AutoMigrate(entity)
		if err != nil {
			panic(err)
		}
	}
	cron.Init()
	router.Init()
	if err := router.Engine.Run(":" + common.CONFIG.Port); err != nil {
		panic(err)
	}
}
